home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / acpid.preinst < prev    next >
Text File  |  2009-09-23  |  1KB  |  44 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. # Automatically added by dh_installinit
  6. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  7.     if [ -e "/etc/init.d/acpid" ] && [ ! -L "/etc/init.d/acpid" ]; then
  8.         if [ "`md5sum \"/etc/init.d/acpid\" | sed -e \"s/ .*//\"`" != \
  9.              "`dpkg-query -W -f='${Conffiles}' acpid | sed -n -e \"\\\\' /etc/init.d/acpid '{s/ obsolete$//;s/.* //p}\"`" ]
  10.         then
  11.             echo "Obsolete conffile /etc/init.d/acpid has been modified by you, renaming to .dpkg-bak"
  12.             mv -f "/etc/init.d/acpid" "/etc/init.d/acpid.dpkg-bak"
  13.         else
  14.             rm -f "/etc/init.d/acpid"
  15.         fi
  16.     fi
  17. fi
  18. # End automatically added section
  19.  
  20.  
  21. # Remove a no-longer used conffile
  22. rm_conffile() {
  23.     PKGNAME="$1"
  24.     CONFFILE="$2"
  25.     if [ -e "$CONFFILE" ]; then
  26.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  27.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  28.         if [ "$md5sum" != "$old_md5sum" ]; then
  29.             echo "Obsolete conffile $CONFFILE has been modified by you."
  30.             echo "Saving as $CONFFILE.dpkg-bak ..."
  31.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  32.         else
  33.             echo "Removing obsolete conffile $CONFFILE ..."
  34.             rm -f "$CONFFILE"
  35.         fi
  36.     fi
  37. }
  38. case "$1" in
  39.   install|upgrade)
  40.     rm_conffile acpid /etc/logrotate.d/acpid
  41.   ;;
  42. esac
  43.  
  44.